package cn.itsource.ymcc.service.impl;

import cn.itsource.ymcc.domain.KillActivity;
import cn.itsource.ymcc.mapper.KillActivityMapper;
import cn.itsource.ymcc.service.IKillActivityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cff
 * @since 2024-06-24
 */
@Service
public class KillActivityServiceImpl extends ServiceImpl<KillActivityMapper, KillActivity> implements IKillActivityService {

    @Override
    public boolean save(KillActivity entity) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss EE");

        entity.setTimeStr( simpleDateFormat.format(entity.getBeginTime()).toString().substring(5,10)
                + "至" + simpleDateFormat.format(entity.getEndTime()).toString().substring(5,10));
        entity.setPublishTime(new Date());
        System.out.println(entity.getBeginTime().toString().substring(5,10));
        return super.save(entity);
    }

    public static void main(String[] args) {
        String date = "2024-06-24 19:47:30";
        //System.out.println(date.substring(5, 10));
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss EE");
        System.out.println(simpleDateFormat.format(new Date()));
    }
}

